package logic

import (
	"context"
	"house/house"

	"api/internal/svc"
	"api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShowListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewShowListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowListLogic {
	return &ShowListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ShowListLogic) ShowList(req *types.ShowListRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	show, err := l.svcCtx.HouseSrv.ShowList(l.ctx, &house.ShowListRequest{
		Id: req.Id,
	})

	if err != nil {
		return &types.Response{
			Code:     500,
			Messages: err.Error(),
			Data:     nil,
		}, nil
	}

	return &types.Response{
		Code:     200,
		Messages: "查看成功",
		Data:     show,
	}, nil
}
